This document presents the R code and output from the GLM models behind the results on the effects of MHC-I functional divergence on fitness in adult great reed warblers reported in the paper:

Roved J., Hansson B., Tarka M., Hasselquist D., & Westerdahl H. (2019). MHC-I functional divergence is positively associated with life span and fitness in male great reed warblers: support for the divergent allele advantage hypothesis.

The data set is available at the datadryad.org repository, the link is specified in the paper mentioned above.

Note: The variable names employed in the models stem from our original analyses. The names of the corresponding variables in the data set that is publicly available at the respository are given below:

LifeSpan = Life span
ToSucLife_1014 = Lifetime no. fledglings
RecruLife_1014 = Lifetime no. recruiting offspring
Total.no.alleles = No. MHC-I alleles
PdistPBR = P-distance PBR
PdistPSS = P-distance PSS


Subset the data.

data.males <- subset(data, Sex=="male")
data.females <- subset(data,Sex=="female")

Load R packages.

library(MASS)

Function to test for overdispersion in GLM models using Pearson residuals (courtesy of Ben Bolker).

overdisp_fun <- function(model) {
rdf <- df.residual(model)
rp <- residuals(model,type="pearson")
Pearson.chisq <- sum(rp^2)
prat <- Pearson.chisq/rdf
pval <- pchisq(Pearson.chisq, df=rdf, lower.tail=FALSE)
c(chisq=Pearson.chisq,ratio=prat,rdf=rdf,p=pval)
}

Modeling the effects of MHC-I functional divergence on life span

GLM of life span on total number of alleles and P-distance PBR in males only

fm1_PBR <- glm(LifeSpan~Total.no.alleles+PdistPBR,negative.binomial(theta=5.14632,link="log"),data=data.males[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s1_PBR <- summary(fm1_PBR)
s1_PBR
## 
## Call:
## glm(formula = LifeSpan ~ Total.no.alleles + PdistPBR, family = negative.binomial(theta = 5.14632, 
##     link = "log"), data = data.males[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5050  -0.4432  -0.1066   0.3828   1.2933  
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)   
## (Intercept)      -2.76368    1.30462  -2.118  0.03755 * 
## Total.no.alleles  0.02781    0.01811   1.535  0.12902   
## PdistPBR         11.66330    3.67272   3.176  0.00219 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(5.1463) family taken to be 0.3432786)
## 
##     Null deviance: 28.754  on 75  degrees of freedom
## Residual deviance: 25.249  on 73  degrees of freedom
## AIC: 303.35
## 
## Number of Fisher Scoring iterations: 4
overdisp_fun(fm1_PBR)
##      chisq      ratio        rdf          p 
## 25.0593297  0.3432785 73.0000000  1.0000000
par(mfrow=c(2,2))
plot(fm1_PBR)

GLM of life span on total number of alleles and P-distance PSS in males only

fm1_PSS <- glm(LifeSpan~Total.no.alleles+PdistPSS,negative.binomial(theta=5.14632,link="log"),data=data.males[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s1_PSS <- summary(fm1_PSS)
s1_PSS
## 
## Call:
## glm(formula = LifeSpan ~ Total.no.alleles + PdistPSS, family = negative.binomial(theta = 5.14632, 
##     link = "log"), data = data.males[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4432  -0.4743  -0.1057   0.3282   1.3444  
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)  
## (Intercept)      -2.31280    1.75402  -1.319   0.1914  
## Total.no.alleles  0.02288    0.02022   1.132   0.2615  
## PdistPSS          9.01796    4.32516   2.085   0.0406 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(5.1463) family taken to be 0.3774148)
## 
##     Null deviance: 28.754  on 75  degrees of freedom
## Residual deviance: 27.094  on 73  degrees of freedom
## AIC: 305.19
## 
## Number of Fisher Scoring iterations: 4
overdisp_fun(fm1_PSS)
##      chisq      ratio        rdf          p 
## 27.5512777  0.3774148 73.0000000  0.9999997
par(mfrow=c(2,2))
plot(fm1_PSS)

GLM of life span on total number of alleles and P-distance PBR in females only

fm2_PBR <- glm(LifeSpan~Total.no.alleles+PdistPBR,negative.binomial(theta=5.14632,link="log"),data=data.females[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s2_PBR <- summary(fm2_PBR)
s2_PBR
## 
## Call:
## glm(formula = LifeSpan ~ Total.no.alleles + PdistPBR, family = negative.binomial(theta = 5.14632, 
##     link = "log"), data = data.females[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.3148  -0.6869  -0.1884   0.5797   1.8134  
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)
## (Intercept)       1.264632   1.786757   0.708    0.481
## Total.no.alleles  0.005697   0.022879   0.249    0.804
## PdistPBR         -0.346263   5.370565  -0.064    0.949
## 
## (Dispersion parameter for Negative Binomial(5.1463) family taken to be 0.8213017)
## 
##     Null deviance: 72.819  on 94  degrees of freedom
## Residual deviance: 72.750  on 92  degrees of freedom
## AIC: 404.93
## 
## Number of Fisher Scoring iterations: 4
overdisp_fun(fm2_PBR)
##      chisq      ratio        rdf          p 
## 75.5597338  0.8213015 92.0000000  0.8930381
par(mfrow=c(2,2))
plot(fm2_PBR)

GLM of life span on total number of alleles and P-distance PSS in females only

fm2_PSS <- glm(LifeSpan~Total.no.alleles+PdistPSS,negative.binomial(theta=5.14632,link="log"),data=data.females[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s2_PSS <- summary(fm2_PSS)
s2_PSS
## 
## Call:
## glm(formula = LifeSpan ~ Total.no.alleles + PdistPSS, family = negative.binomial(theta = 5.14632, 
##     link = "log"), data = data.females[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4313  -0.6993  -0.1710   0.4724   1.8661  
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)
## (Intercept)       3.179939   2.035643   1.562    0.122
## Total.no.alleles -0.001591   0.022660  -0.070    0.944
## PdistPSS         -5.357085   5.362257  -0.999    0.320
## 
## (Dispersion parameter for Negative Binomial(5.1463) family taken to be 0.8063923)
## 
##     Null deviance: 72.819  on 94  degrees of freedom
## Residual deviance: 71.945  on 92  degrees of freedom
## AIC: 404.13
## 
## Number of Fisher Scoring iterations: 4
overdisp_fun(fm2_PSS)
##      chisq      ratio        rdf          p 
## 74.1880032  0.8063913 92.0000000  0.9129155
par(mfrow=c(2,2))
plot(fm2_PSS)

GLM of life span on total number of alleles and P-distance PBR in both sexes

fm3_PBR <- glm(LifeSpan~Total.no.alleles+PdistPBR+Sex+Total.no.alleles:Sex+PdistPBR:Sex,negative.binomial(theta=5.14632,link="log"),data=data[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s3_PBR <- summary(fm3_PBR)
s3_PBR
## 
## Call:
## glm(formula = LifeSpan ~ Total.no.alleles + PdistPBR + Sex + 
##     Total.no.alleles:Sex + PdistPBR:Sex, family = negative.binomial(theta = 5.14632, 
##     link = "log"), data = data[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5050  -0.6573  -0.1750   0.4280   1.8134  
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)  
## (Intercept)               1.264632   1.539616   0.821   0.4126  
## Total.no.alleles          0.005697   0.019714   0.289   0.7730  
## PdistPBR                 -0.346263   4.627717  -0.075   0.9404  
## Sexmale                  -4.028310   2.322488  -1.734   0.0847 .
## Total.no.alleles:Sexmale  0.022109   0.031166   0.709   0.4791  
## PdistPBR:Sexmale         12.009561   6.736310   1.783   0.0765 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(5.1463) family taken to be 0.6098127)
## 
##     Null deviance: 101.638  on 170  degrees of freedom
## Residual deviance:  97.999  on 165  degrees of freedom
## AIC: 708.28
## 
## Number of Fisher Scoring iterations: 4
overdisp_fun(fm3_PBR)
##       chisq       ratio         rdf           p 
## 100.6190635   0.6098125 165.0000000   0.9999804
par(mfrow=c(2,2))
plot(fm3_PBR)

GLM of life span on total number of alleles and P-distance PSS in both sexes

fm3_PSS <- glm(LifeSpan~Total.no.alleles+PdistPSS+Sex+Total.no.alleles:Sex+PdistPSS:Sex,negative.binomial(theta=5.14632,link="log"),data=data[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s3_PSS <- summary(fm3_PSS)
s3_PSS
## 
## Call:
## glm(formula = LifeSpan ~ Total.no.alleles + PdistPSS + Sex + 
##     Total.no.alleles:Sex + PdistPSS:Sex, family = negative.binomial(theta = 5.14632, 
##     link = "log"), data = data[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4432  -0.6218  -0.1523   0.3805   1.8661  
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)  
## (Intercept)               3.179939   1.780045   1.786   0.0759 .
## Total.no.alleles         -0.001591   0.019815  -0.080   0.9361  
## PdistPSS                 -5.357085   4.688965  -1.142   0.2549  
## Sexmale                  -5.492737   2.862678  -1.919   0.0567 .
## Total.no.alleles:Sexmale  0.024473   0.032567   0.751   0.4534  
## PdistPSS:Sexmale         14.375044   7.249065   1.983   0.0490 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(5.1463) family taken to be 0.6166023)
## 
##     Null deviance: 101.638  on 170  degrees of freedom
## Residual deviance:  99.039  on 165  degrees of freedom
## AIC: 709.32
## 
## Number of Fisher Scoring iterations: 4
overdisp_fun(fm3_PSS)
##       chisq       ratio         rdf           p 
## 101.7392809   0.6166017 165.0000000   0.9999717
par(mfrow=c(2,2))
plot(fm3_PSS)


Modeling the effects of MHC-I functional divergence on lifetime number of fledgings

GLM of lifetime number of fledgings on total number of alleles and P-distance PBR in males only

fm4_PBR <- glm(ToSucLife_1014~Total.no.alleles+PdistPBR,negative.binomial(theta=1.656555,link="log"),data=data.males[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s4_PBR <- summary(fm4_PBR)
s4_PBR
## 
## Call:
## glm(formula = ToSucLife_1014 ~ Total.no.alleles + PdistPBR, family = negative.binomial(theta = 1.656555, 
##     link = "log"), data = data.males[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1104  -0.8979  -0.2296   0.3733   1.6130  
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)   
## (Intercept)      -4.77799    2.36035  -2.024  0.04660 * 
## Total.no.alleles  0.04216    0.03285   1.283  0.20344   
## PdistPBR         21.95219    6.66919   3.292  0.00154 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(1.6566) family taken to be 0.8162788)
## 
##     Null deviance: 71.194  on 75  degrees of freedom
## Residual deviance: 61.065  on 73  degrees of freedom
## AIC: 548.69
## 
## Number of Fisher Scoring iterations: 5
overdisp_fun(fm4_PBR)
##      chisq      ratio        rdf          p 
## 59.5882720  0.8162777 73.0000000  0.8708043
par(mfrow=c(2,2))
plot(fm4_PBR)

GLM of lifetime number of fledgings on total number of alleles and P-distance PSS in males only

fm4_PSS <- glm(ToSucLife_1014~Total.no.alleles+PdistPSS,negative.binomial(theta=1.656555,link="log"),data=data.males[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s4_PSS <- summary(fm4_PSS)
s4_PSS
## 
## Call:
## glm(formula = ToSucLife_1014 ~ Total.no.alleles + PdistPSS, family = negative.binomial(theta = 1.656555, 
##     link = "log"), data = data.males[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2487  -0.9171  -0.2981   0.4302   1.9706  
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)  
## (Intercept)      -3.72706    3.21410  -1.160   0.2500  
## Total.no.alleles  0.02535    0.03699   0.685   0.4953  
## PdistPSS         16.73262    7.94661   2.106   0.0387 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(1.6566) family taken to be 0.9075688)
## 
##     Null deviance: 71.194  on 75  degrees of freedom
## Residual deviance: 66.568  on 73  degrees of freedom
## AIC: 554.19
## 
## Number of Fisher Scoring iterations: 6
overdisp_fun(fm4_PSS)
##      chisq      ratio        rdf          p 
## 66.2526731  0.9075709 73.0000000  0.6988037
par(mfrow=c(2,2))
plot(fm4_PSS)

GLM of lifetime number of fledgings on total number of alleles and P-distance PBR in females only

fm5_PBR <- glm(ToSucLife_1014~Total.no.alleles+PdistPBR,negative.binomial(theta=1.656555,link="log"),data=data.females[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s5_PBR <- summary(fm5_PBR)
s5_PBR
## 
## Call:
## glm(formula = ToSucLife_1014 ~ Total.no.alleles + PdistPBR, family = negative.binomial(theta = 1.656555, 
##     link = "log"), data = data.females[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.7646  -0.7670  -0.3059   0.3335   2.0569  
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)
## (Intercept)       3.19732    2.06239   1.550    0.125
## Total.no.alleles  0.01181    0.02644   0.447    0.656
## PdistPBR         -3.38634    6.19942  -0.546    0.586
## 
## (Dispersion parameter for Negative Binomial(1.6566) family taken to be 0.7562186)
## 
##     Null deviance: 63.653  on 94  degrees of freedom
## Residual deviance: 63.063  on 92  degrees of freedom
## AIC: 618.72
## 
## Number of Fisher Scoring iterations: 6
overdisp_fun(fm5_PBR)
##      chisq      ratio        rdf          p 
## 69.5720925  0.7562184 92.0000000  0.9608471
par(mfrow=c(2,2))
plot(fm5_PBR)

GLM of lifetime number of fledgings on total number of alleles and P-distance PSS in females only

fm5_PSS <- glm(ToSucLife_1014~Total.no.alleles+PdistPSS,negative.binomial(theta=1.656555,link="log"),data=data.females[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s5_PSS <- summary(fm5_PSS)
s5_PSS
## 
## Call:
## glm(formula = ToSucLife_1014 ~ Total.no.alleles + PdistPSS, family = negative.binomial(theta = 1.656555, 
##     link = "log"), data = data.females[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.7586  -0.7825  -0.3324   0.4298   2.0345  
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)  
## (Intercept)       5.08582    2.35264   2.162   0.0332 *
## Total.no.alleles  0.00407    0.02605   0.156   0.8762  
## PdistPSS         -7.90094    6.19254  -1.276   0.2052  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(1.6566) family taken to be 0.7343895)
## 
##     Null deviance: 63.653  on 94  degrees of freedom
## Residual deviance: 62.076  on 92  degrees of freedom
## AIC: 617.73
## 
## Number of Fisher Scoring iterations: 5
overdisp_fun(fm5_PSS)
##      chisq      ratio        rdf          p 
## 67.5638913  0.7343901 92.0000000  0.9738731
par(mfrow=c(2,2))
plot(fm5_PSS)

GLM of lifetime number of fledgings on total number of alleles and P-distance PBR in both sexes

fm6_PBR <- glm(ToSucLife_1014~Total.no.alleles+PdistPBR+Sex+Total.no.alleles:Sex+PdistPBR:Sex,negative.binomial(theta=1.656555,link="log"),data=data[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s6_PBR <- summary(fm6_PBR)
s6_PBR
## 
## Call:
## glm(formula = ToSucLife_1014 ~ Total.no.alleles + PdistPBR + 
##     Sex + Total.no.alleles:Sex + PdistPBR:Sex, family = negative.binomial(theta = 1.656555, 
##     link = "log"), data = data[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1104  -0.8215  -0.2475   0.3559   2.0569  
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)   
## (Intercept)               3.19732    2.09831   1.524  0.12948   
## Total.no.alleles          0.01181    0.02690   0.439  0.66129   
## PdistPBR                 -3.38634    6.30739  -0.537  0.59207   
## Sexmale                  -7.97518    3.12179  -2.555  0.01153 * 
## Total.no.alleles:Sexmale  0.03035    0.04194   0.724  0.47029   
## PdistPBR:Sexmale         25.33822    9.07946   2.791  0.00588 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(1.6566) family taken to be 0.7827894)
## 
##     Null deviance: 143.78  on 170  degrees of freedom
## Residual deviance: 124.13  on 165  degrees of freedom
## AIC: 1167.4
## 
## Number of Fisher Scoring iterations: 6
overdisp_fun(fm6_PBR)
##       chisq       ratio         rdf           p 
## 129.1602445   0.7827894 165.0000000   0.9821231
par(mfrow=c(2,2))
plot(fm6_PBR)

GLM of lifetime number of fledgings on total number of alleles and P-distance PSS in both sexes

fm6_PSS <- glm(ToSucLife_1014~Total.no.alleles+PdistPSS+Sex+Total.no.alleles:Sex+PdistPSS:Sex,negative.binomial(theta=1.656555,link="log"),data=data[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s6_PSS <- summary(fm6_PSS)
s6_PSS
## 
## Call:
## glm(formula = ToSucLife_1014 ~ Total.no.alleles + PdistPSS + 
##     Sex + Total.no.alleles:Sex + PdistPSS:Sex, family = negative.binomial(theta = 1.656555, 
##     link = "log"), data = data[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2487  -0.8420  -0.3253   0.4339   2.0345  
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)  
## (Intercept)               5.085983   2.472325   2.057   0.0412 *
## Total.no.alleles          0.004071   0.027371   0.149   0.8819  
## PdistPSS                 -7.901424   6.507563  -1.214   0.2264  
## Sexmale                  -8.813039   3.917111  -2.250   0.0258 *
## Total.no.alleles:Sexmale  0.021282   0.044408   0.479   0.6324  
## PdistPSS:Sexmale         24.634040   9.938732   2.479   0.0142 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(1.6566) family taken to be 0.8110086)
## 
##     Null deviance: 143.78  on 170  degrees of freedom
## Residual deviance: 128.64  on 165  degrees of freedom
## AIC: 1171.9
## 
## Number of Fisher Scoring iterations: 6
overdisp_fun(fm6_PSS)
##       chisq       ratio         rdf           p 
## 133.8165637   0.8110095 165.0000000   0.9641613
par(mfrow=c(2,2))
plot(fm6_PSS)


Modeling the effects of MHC-I functional divergence on lifetime number of recruits

GLM of lifetime number of recruits on total number of alleles and P-distance PBR in males only

fm7_PBR <- glm(RecruLife_1014~Total.no.alleles+PdistPBR,negative.binomial(theta=1.40551,link="log"),data=data.males[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s7_PBR <- summary(fm7_PBR)
s7_PBR
## 
## Call:
## glm(formula = RecruLife_1014 ~ Total.no.alleles + PdistPBR, family = negative.binomial(theta = 1.40551, 
##     link = "log"), data = data.males[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.7826  -0.7714  -0.2091   0.3456   1.5977  
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)   
## (Intercept)      -9.69571    3.11922  -3.108  0.00268 **
## Total.no.alleles  0.09970    0.04266   2.337  0.02219 * 
## PdistPBR         28.94496    8.73674   3.313  0.00144 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(1.4055) family taken to be 0.7232984)
## 
##     Null deviance: 73.051  on 75  degrees of freedom
## Residual deviance: 64.076  on 73  degrees of freedom
## AIC: 290.62
## 
## Number of Fisher Scoring iterations: 5
overdisp_fun(fm7_PBR)
##      chisq      ratio        rdf          p 
## 52.8009289  0.7233004 73.0000000  0.9640887
par(mfrow=c(2,2))
plot(fm7_PBR)

GLM of lifetime number of recruits on total number of alleles and P-distance PSS in males only

fm7_PSS <- glm(RecruLife_1014~Total.no.alleles+PdistPSS,negative.binomial(theta=1.40551,link="log"),data=data.males[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s7_PSS <- summary(fm7_PSS)
s7_PSS
## 
## Call:
## glm(formula = RecruLife_1014 ~ Total.no.alleles + PdistPSS, family = negative.binomial(theta = 1.40551, 
##     link = "log"), data = data.males[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.8120  -0.7114  -0.1635   0.3208   2.0971  
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)  
## (Intercept)      -10.26910    4.20981  -2.439   0.0171 *
## Total.no.alleles   0.09372    0.04826   1.942   0.0560 .
## PdistPSS          26.86065   10.33874   2.598   0.0113 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(1.4055) family taken to be 0.8291243)
## 
##     Null deviance: 73.051  on 75  degrees of freedom
## Residual deviance: 67.128  on 73  degrees of freedom
## AIC: 293.67
## 
## Number of Fisher Scoring iterations: 5
overdisp_fun(fm7_PSS)
##      chisq      ratio        rdf          p 
## 60.5258756  0.8291216 73.0000000  0.8512463
par(mfrow=c(2,2))
plot(fm7_PSS)

GLM of lifetime number of recruits on total number of alleles and P-distance PBR in females only

fm8_PBR <- glm(RecruLife_1014~Total.no.alleles+PdistPBR,negative.binomial(theta=1.40551,link="log"),data=data.females[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s8_PBR <- summary(fm8_PBR)
s8_PBR
## 
## Call:
## glm(formula = RecruLife_1014 ~ Total.no.alleles + PdistPBR, family = negative.binomial(theta = 1.40551, 
##     link = "log"), data = data.females[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.6347  -1.4625  -0.3396   0.3135   2.3327  
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)
## (Intercept)      -0.53598    3.44587  -0.156    0.877
## Total.no.alleles -0.04161    0.04371  -0.952    0.344
## PdistPBR          5.22055   10.36608   0.504    0.616
## 
## (Dispersion parameter for Negative Binomial(1.4055) family taken to be 1.102901)
## 
##     Null deviance: 113.2  on 94  degrees of freedom
## Residual deviance: 111.5  on 92  degrees of freedom
## AIC: 345.37
## 
## Number of Fisher Scoring iterations: 5
overdisp_fun(fm8_PBR)
##       chisq       ratio         rdf           p 
## 101.4667300   1.1028992  92.0000000   0.2345127
par(mfrow=c(2,2))
plot(fm8_PBR)

GLM of lifetime number of recruits on total number of alleles and P-distance PSS in females only

fm8_PSS <- glm(RecruLife_1014~Total.no.alleles+PdistPSS,negative.binomial(theta=1.40551,link="log"),data=data.females[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s8_PSS <- summary(fm8_PSS)
s8_PSS
## 
## Call:
## glm(formula = RecruLife_1014 ~ Total.no.alleles + PdistPSS, family = negative.binomial(theta = 1.40551, 
##     link = "log"), data = data.females[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.7596  -1.4213  -0.4168   0.3066   2.4245  
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)
## (Intercept)       4.10393    3.92662   1.045    0.299
## Total.no.alleles -0.06025    0.04425  -1.362    0.177
## PdistPSS         -7.68950   10.33549  -0.744    0.459
## 
## (Dispersion parameter for Negative Binomial(1.4055) family taken to be 1.125134)
## 
##     Null deviance: 113.20  on 94  degrees of freedom
## Residual deviance: 111.23  on 92  degrees of freedom
## AIC: 345.1
## 
## Number of Fisher Scoring iterations: 5
overdisp_fun(fm8_PSS)
##       chisq       ratio         rdf           p 
## 103.5124441   1.1251353  92.0000000   0.1936933
par(mfrow=c(2,2))
plot(fm8_PSS)

GLM of lifetime number of recruits on total number of alleles and P-distance PBR in both sexes

fm9_PBR <- glm(RecruLife_1014~Total.no.alleles+PdistPBR+Sex+Total.no.alleles:Sex+PdistPBR:Sex,negative.binomial(theta=1.40551,link="log"),data=data[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s9_PBR <- summary(fm9_PBR)
s9_PBR
## 
## Call:
## glm(formula = RecruLife_1014 ~ Total.no.alleles + PdistPBR + 
##     Sex + Total.no.alleles:Sex + PdistPBR:Sex, family = negative.binomial(theta = 1.40551, 
##     link = "log"), data = data[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.7826  -1.3926  -0.2654   0.3280   2.3327  
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)  
## (Intercept)              -0.53598    3.17268  -0.169   0.8661  
## Total.no.alleles         -0.04161    0.04024  -1.034   0.3026  
## PdistPBR                  5.22055    9.54425   0.547   0.5851  
## Sexmale                  -9.15973    4.75842  -1.925   0.0560 .
## Total.no.alleles:Sexmale  0.14132    0.06303   2.242   0.0263 *
## PdistPBR:Sexmale         23.72440   13.77533   1.722   0.0869 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(1.4055) family taken to be 0.9349556)
## 
##     Null deviance: 187.69  on 170  degrees of freedom
## Residual deviance: 175.58  on 165  degrees of freedom
## AIC: 635.99
## 
## Number of Fisher Scoring iterations: 5
overdisp_fun(fm9_PBR)
##       chisq       ratio         rdf           p 
## 154.2676589   0.9349555 165.0000000   0.7147116
par(mfrow=c(2,2))
plot(fm9_PBR)

GLM of lifetime number of recruits on total number of alleles and P-distance PSS in both sexes

fm9_PSS <- glm(RecruLife_1014~Total.no.alleles+PdistPSS+Sex+Total.no.alleles:Sex+PdistPSS:Sex,negative.binomial(theta=1.40551,link="log"),data=data[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s9_PSS <- summary(fm9_PSS)
s9_PSS
## 
## Call:
## glm(formula = RecruLife_1014 ~ Total.no.alleles + PdistPSS + 
##     Sex + Total.no.alleles:Sex + PdistPSS:Sex, family = negative.binomial(theta = 1.40551, 
##     link = "log"), data = data[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.8120  -1.3934  -0.2542   0.3154   2.4245  
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)  
## (Intercept)                4.10393    3.69103   1.112   0.2678  
## Total.no.alleles          -0.06025    0.04159  -1.449   0.1493  
## PdistPSS                  -7.68950    9.71538  -0.791   0.4298  
## Sexmale                  -14.37303    5.90543  -2.434   0.0160 *
## Total.no.alleles:Sexmale   0.15397    0.06725   2.290   0.0233 *
## PdistPSS:Sexmale          34.55016   14.91831   2.316   0.0218 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for Negative Binomial(1.4055) family taken to be 0.9941722)
## 
##     Null deviance: 187.69  on 170  degrees of freedom
## Residual deviance: 178.36  on 165  degrees of freedom
## AIC: 638.77
## 
## Number of Fisher Scoring iterations: 5
overdisp_fun(fm9_PSS)
##       chisq       ratio         rdf           p 
## 164.0383197   0.9941716 165.0000000   0.5065083
par(mfrow=c(2,2))
plot(fm9_PSS)


Modeling the effects of MHC-I functional divergence on offspring fledging success

Linear model of lifetime number of fledgings on total number of alleles and P-distance PBR with lifespan as covariate in males only

fm10_PBR <- lm(ToSucLife_1014~LifeSpan+Total.no.alleles+PdistPBR,data=data.males[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s10_PBR <- summary(fm10_PBR)
s10_PBR
## 
## Call:
## lm(formula = ToSucLife_1014 ~ LifeSpan + Total.no.alleles + PdistPBR, 
##     data = data.males[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##         ])
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -23.6438  -5.8328  -0.8704   5.4632  23.3595 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -52.5044    29.4221  -1.785   0.0786 .  
## LifeSpan           4.7575     0.7195   6.612 5.68e-09 ***
## Total.no.alleles   0.2099     0.4034   0.520   0.6044    
## PdistPBR         152.3550    85.6042   1.780   0.0793 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 9.061 on 72 degrees of freedom
## Multiple R-squared:  0.4644, Adjusted R-squared:  0.4421 
## F-statistic: 20.81 on 3 and 72 DF,  p-value: 8.194e-10
par(mfrow=c(2,2))
plot(fm10_PBR)

Linear model of lifetime number of fledgings on total number of alleles and P-distance PSS with lifespan as covariate in males only

fm10_PSS <- lm(ToSucLife_1014~LifeSpan+Total.no.alleles+PdistPSS,data=data.males[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s10_PSS <- summary(fm10_PSS)
s10_PSS
## 
## Call:
## lm(formula = ToSucLife_1014 ~ LifeSpan + Total.no.alleles + PdistPSS, 
##     data = data.males[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##         ])
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -23.6097  -5.4712  -0.6145   5.1370  24.1169 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -38.09164   38.25115  -0.996    0.323    
## LifeSpan           5.02654    0.70723   7.107    7e-10 ***
## Total.no.alleles   0.07344    0.43684   0.168    0.867    
## PdistPSS          94.07153   96.00763   0.980    0.330    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 9.198 on 72 degrees of freedom
## Multiple R-squared:  0.4482, Adjusted R-squared:  0.4252 
## F-statistic: 19.49 on 3 and 72 DF,  p-value: 2.356e-09
par(mfrow=c(2,2))
plot(fm10_PSS)

Linear model of lifetime number of fledgings on total number of alleles and P-distance PBR with lifespan as covariate in females only

fm11_PBR <- lm(ToSucLife_1014~LifeSpan+Total.no.alleles+PdistPBR,data=data.females[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s11_PBR <- summary(fm11_PBR)
s11_PBR
## 
## Call:
## lm(formula = ToSucLife_1014 ~ LifeSpan + Total.no.alleles + PdistPBR, 
##     data = data.females[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##         ])
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -10.1845  -2.1607   0.1229   1.6074  12.2748 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       11.11888   11.25593   0.988    0.326    
## LifeSpan           2.83950    0.19055  14.901   <2e-16 ***
## Total.no.alleles   0.06114    0.14379   0.425    0.672    
## PdistPBR         -37.50437   33.77333  -1.110    0.270    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.965 on 91 degrees of freedom
## Multiple R-squared:  0.7121, Adjusted R-squared:  0.7026 
## F-statistic: 75.02 on 3 and 91 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(fm11_PBR)

Linear model of lifetime number of fledgings on total number of alleles and P-distance PSS with lifespan as covariate in females only

fm11_PSS <- lm(ToSucLife_1014~LifeSpan+Total.no.alleles+PdistPSS,data=data.females[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s11_PSS <- summary(fm11_PSS)
s11_PSS
## 
## Call:
## lm(formula = ToSucLife_1014 ~ LifeSpan + Total.no.alleles + PdistPSS, 
##     data = data.females[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##         ])
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -10.3651  -2.0775   0.1081   1.6705  13.0347 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       11.40047   13.17409   0.865    0.389    
## LifeSpan           2.82151    0.19194  14.700   <2e-16 ***
## Total.no.alleles   0.06757    0.14389   0.470    0.640    
## PdistPSS         -33.30141   34.45899  -0.966    0.336    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.971 on 91 degrees of freedom
## Multiple R-squared:  0.7111, Adjusted R-squared:  0.7016 
## F-statistic: 74.68 on 3 and 91 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(fm11_PSS)

Linear model of lifetime number of fledgings on total number of alleles and P-distance PBR with lifespan as covariate in both sexes

fm12_PBR <- lm(ToSucLife_1014~LifeSpan+Total.no.alleles+PdistPBR+Sex+Total.no.alleles:Sex+PdistPBR:Sex,data=data[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s12_PBR <- summary(fm12_PBR)
s12_PBR
## 
## Call:
## lm(formula = ToSucLife_1014 ~ LifeSpan + Total.no.alleles + PdistPBR + 
##     Sex + Total.no.alleles:Sex + PdistPBR:Sex, data = data[!is.na(PdistPBR) & 
##     !is.na(ToSucLife_1014), ])
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -20.6629  -3.5429  -0.4787   3.1341  27.4032 
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                9.26681   19.53120   0.474   0.6358    
## LifeSpan                   3.35383    0.28300  11.851   <2e-16 ***
## Total.no.alleles           0.05105    0.24961   0.205   0.8382    
## PdistPBR                 -36.79178   58.63195  -0.628   0.5312    
## Sexmale                  -76.15279   29.39188  -2.591   0.0104 *  
## Total.no.alleles:Sexmale   0.29404    0.39225   0.750   0.4546    
## PdistPBR:Sexmale         245.28201   85.58624   2.866   0.0047 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6.883 on 164 degrees of freedom
## Multiple R-squared:  0.5405, Adjusted R-squared:  0.5236 
## F-statistic: 32.15 on 6 and 164 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(fm12_PBR)

Linear model of lifetime number of fledgings on total number of alleles and P-distance PSS with lifespan as covariate in both sexes

fm12_PSS <- lm(ToSucLife_1014~LifeSpan+Total.no.alleles+PdistPSS+Sex+Total.no.alleles:Sex+PdistPSS:Sex,data=data[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s12_PSS <- summary(fm12_PSS)
s12_PSS
## 
## Call:
## lm(formula = ToSucLife_1014 ~ LifeSpan + Total.no.alleles + PdistPSS + 
##     Sex + Total.no.alleles:Sex + PdistPSS:Sex, data = data[!is.na(PdistPSS) & 
##     !is.na(ToSucLife_1014), ])
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -20.0382  -3.5805  -0.2141   3.2492  29.3120 
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                4.96890   23.26213   0.214    0.831    
## LifeSpan                   3.44599    0.28785  11.971   <2e-16 ***
## Total.no.alleles           0.06869    0.25489   0.269    0.788    
## PdistPSS                 -21.42623   60.94379  -0.352    0.726    
## Sexmale                  -57.24369   37.35539  -1.532    0.127    
## Total.no.alleles:Sexmale   0.13088    0.41867   0.313    0.755    
## PdistPSS:Sexmale         165.45598   94.84718   1.744    0.083 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.034 on 164 degrees of freedom
## Multiple R-squared:   0.52,  Adjusted R-squared:  0.5024 
## F-statistic: 29.61 on 6 and 164 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(fm12_PSS)


Modeling the effects of MHC-I functional divergence on offspring recruitment success

Linear model of lifetime number of recruits on total number of alleles and P-distance PBR with lifetime number of fledglings as covariate in males only

fm13_PBR <- lm(RecruLife_1014~ToSucLife_1014+Total.no.alleles+PdistPBR,data=data.males[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s13_PBR <- summary(fm13_PBR)
s13_PBR
## 
## Call:
## lm(formula = RecruLife_1014 ~ ToSucLife_1014 + Total.no.alleles + 
##     PdistPBR, data = data.males[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.4679 -0.6180 -0.1508  0.5467  3.6382 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -5.48675    3.70735  -1.480   0.1432    
## ToSucLife_1014    0.13848    0.01149  12.054   <2e-16 ***
## Total.no.alleles  0.11761    0.04971   2.366   0.0207 *  
## PdistPBR         12.80035   10.71313   1.195   0.2361    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.12 on 72 degrees of freedom
## Multiple R-squared:  0.7178, Adjusted R-squared:  0.706 
## F-statistic: 61.04 on 3 and 72 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(fm13_PBR)

Linear model of lifetime number of recruits on total number of alleles and P-distance PSS with lifetime number of fledglings as covariate in males only

fm13_PSS <- lm(RecruLife_1014~ToSucLife_1014+Total.no.alleles+PdistPSS,data=data.males[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s13_PSS <- summary(fm13_PSS)
s13_PSS
## 
## Call:
## lm(formula = RecruLife_1014 ~ ToSucLife_1014 + Total.no.alleles + 
##     PdistPSS, data = data.males[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.4205 -0.6302 -0.1484  0.5762  3.5749 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -9.13968    4.63216  -1.973  0.05232 .  
## ToSucLife_1014    0.13900    0.01088  12.775  < 2e-16 ***
## Total.no.alleles  0.14205    0.05242   2.710  0.00841 ** 
## PdistPSS         20.22049   11.57660   1.747  0.08496 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.108 on 72 degrees of freedom
## Multiple R-squared:  0.7239, Adjusted R-squared:  0.7124 
## F-statistic: 62.92 on 3 and 72 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(fm13_PSS)

Linear model of lifetime number of recruits on total number of alleles and P-distance PBR with lifetime number of fledglings as covariate in females only

fm14_PBR <- lm(RecruLife_1014~ToSucLife_1014+Total.no.alleles+PdistPBR,data=data.females[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s14_PBR <- summary(fm14_PBR)
s14_PBR
## 
## Call:
## lm(formula = RecruLife_1014 ~ ToSucLife_1014 + Total.no.alleles + 
##     PdistPBR, data = data.females[!is.na(PdistPBR) & !is.na(ToSucLife_1014), 
##     ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.3836 -0.7834 -0.1138  0.7974  5.2017 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -5.31908    4.10214  -1.297    0.198    
## ToSucLife_1014    0.21433    0.02052  10.446   <2e-16 ***
## Total.no.alleles -0.08760    0.05224  -1.677    0.097 .  
## PdistPBR         19.49656   12.28996   1.586    0.116    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.439 on 91 degrees of freedom
## Multiple R-squared:  0.5521, Adjusted R-squared:  0.5373 
## F-statistic: 37.39 on 3 and 91 DF,  p-value: 7.743e-16
par(mfrow=c(2,2))
plot(fm14_PBR)

Linear model of lifetime number of recruits on total number of alleles and P-distance PSS with lifetime number of fledglings as covariate in females only

fm14_PSS <- lm(RecruLife_1014~ToSucLife_1014+Total.no.alleles+PdistPSS,data=data.females[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s14_PSS <- summary(fm14_PSS)
s14_PSS
## 
## Call:
## lm(formula = RecruLife_1014 ~ ToSucLife_1014 + Total.no.alleles + 
##     PdistPSS, data = data.females[!is.na(PdistPSS) & !is.na(ToSucLife_1014), 
##     ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.5868 -0.7087 -0.1396  0.7950  5.3625 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -1.52332    4.85235  -0.314   0.7543    
## ToSucLife_1014    0.21371    0.02093  10.210   <2e-16 ***
## Total.no.alleles -0.10328    0.05280  -1.956   0.0535 .  
## PdistPSS          6.92181   12.70041   0.545   0.5871    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.457 on 91 degrees of freedom
## Multiple R-squared:  0.5412, Adjusted R-squared:  0.5261 
## F-statistic: 35.78 on 3 and 91 DF,  p-value: 2.288e-15
par(mfrow=c(2,2))
plot(fm14_PBR)

Linear model of lifetime number of recruits on total number of alleles and P-distance PBR with lifetime number of fledglings as covariate in both sexes

fm15_PBR <- lm(RecruLife_1014~ToSucLife_1014+Total.no.alleles+PdistPBR+Sex+Total.no.alleles:Sex+PdistPBR:Sex,data=data[!is.na(PdistPBR)&!is.na(ToSucLife_1014),])
s15_PBR <- summary(fm15_PBR)
s15_PBR
## 
## Call:
## lm(formula = RecruLife_1014 ~ ToSucLife_1014 + Total.no.alleles + 
##     PdistPBR + Sex + Total.no.alleles:Sex + PdistPBR:Sex, data = data[!is.na(PdistPBR) & 
##     !is.na(ToSucLife_1014), ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.7865 -0.8432 -0.1574  0.6730  6.0886 
## 
## Coefficients:
##                           Estimate Std. Error t value Pr(>|t|)    
## (Intercept)               -4.25247    3.82396  -1.112   0.2677    
## ToSucLife_1014             0.16436    0.01121  14.656   <2e-16 ***
## Total.no.alleles          -0.08175    0.04885  -1.674   0.0961 .  
## PdistPBR                  17.42576   11.48167   1.518   0.1310    
## Sexmale                    1.38591    5.86322   0.236   0.8134    
## Total.no.alleles:Sexmale   0.18208    0.07688   2.368   0.0190 *  
## PdistPBR:Sexmale         -13.49193   17.13914  -0.787   0.4323    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.347 on 164 degrees of freedom
## Multiple R-squared:  0.602,  Adjusted R-squared:  0.5874 
## F-statistic: 41.34 on 6 and 164 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(fm15_PBR)

Linear model of lifetime number of recruits on total number of alleles and P-distance PSS with lifetime number of fledglings as covariate in both sexes

fm15_PSS <- lm(RecruLife_1014~ToSucLife_1014+Total.no.alleles+PdistPSS+Sex+Total.no.alleles:Sex+PdistPSS:Sex,data=data[!is.na(PdistPSS)&!is.na(ToSucLife_1014),])
s15_PSS <- summary(fm15_PSS)
s15_PSS
## 
## Call:
## lm(formula = RecruLife_1014 ~ ToSucLife_1014 + Total.no.alleles + 
##     PdistPSS + Sex + Total.no.alleles:Sex + PdistPSS:Sex, data = data[!is.na(PdistPSS) & 
##     !is.na(ToSucLife_1014), ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.9970 -0.8266 -0.1215  0.6371  6.2583 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)               0.53677    4.45724   0.120  0.90429    
## ToSucLife_1014            0.16279    0.01097  14.846  < 2e-16 ***
## Total.no.alleles         -0.10010    0.04900  -2.043  0.04268 *  
## PdistPSS                  2.49426   11.70647   0.213  0.83154    
## Sexmale                  -7.69698    7.22931  -1.065  0.28858    
## Total.no.alleles:Sexmale  0.23085    0.08048   2.869  0.00467 ** 
## PdistPSS:Sexmale         11.70793   18.39705   0.636  0.52540    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.352 on 164 degrees of freedom
## Multiple R-squared:  0.5987, Adjusted R-squared:  0.5841 
## F-statistic: 40.79 on 6 and 164 DF,  p-value: < 2.2e-16
par(mfrow=c(2,2))
plot(fm15_PSS)